<?php
$this->breadcrumbs=array(
	'Syrups'=>array('index'),
	'Manage',
);

$this->menu=array(
	array('label'=>'List Syrup', 'url'=>array('index')),
	array('label'=>'Create Syrup', 'url'=>array('create')),
);

Yii::app()->clientScript->registerScript('search', "
$('.search-button').click(function(){
	$('.search-form').toggle();
	return false;
});
$('.search-form form').submit(function(){
	$.fn.yiiGridView.update('syrup-grid', {
		data: $(this).serialize()
	});
	return false;
});
");
?>

<div id="page-heading">
    <h1><?php echo "Manage Syrup"; ?></h1>
</div>

<div style="float: right; padding-right: 10px">
    <a href="<?php echo CController::createUrl('create') ?>"><?php echo Yii::t('vi', 'Add New'); ?></a>
</div>

<table border="0" width="100%" cellpadding="0" cellspacing="0" id="content-table">
	<tr>
		<th rowspan="3" class="sized"><img src="<?php echo Yii::app()->theme->baseUrl; ?>/images/shared/side_shadowleft.jpg" width="20" height="300" alt="" /></th>
		<th class="topleft"></th>
		<td id="tbl-border-top">&nbsp;</td>
		<th class="topright"></th>
		<th rowspan="3" class="sized"><img src="<?php echo Yii::app()->theme->baseUrl; ?>/images/shared/side_shadowright.jpg" width="20" height="300" alt="" /></th>
	</tr>
	<tr>
		<td id="tbl-border-left"></td>
		<td>
		<!--  start content-table-inner ...................................................................... START -->
		<div id="content-table-inner">
		
			<!--  start table-content  -->
			<div id="table-content">
                            <?php $this->widget('zii.widgets.grid.CGridView', array(
                                    'id'=>'syrup-grid',
                                    'dataProvider'=>$model->search(),
                                    'filter'=>$model,
                                    'columns'=>array(
                                            'syrupname',                                            
                                            'materialid' => array(
                                                    'header' => 'Material',
                                                    'type' => 'html',
                                                    'name' => 'materialid',
                                                    'filter' => CHtml::listData(Material::model()->findAll(), 'materialid', 'materialname'),
                                                    'value' => '$data->material->materialname',
//                                                    'value' => 'menuService::syrupMaterialName($data->materialid)',
                                                ),
                                            'drinktypeid' => array(
                                                    'header' => 'Drink type',
                                                    'name' => 'drinktypeid',
                                                    'filter' => CHtml::listData(Drinktype::model()->findAll(), 'drinktypeid', 'drinktypename'),
                                                    'value' => '$data->drinktype->drinktypename',
                                                ),
                                            'syrupprice' => array(
                                                'header' => 'Syrup Price',
                                                'name' => 'syrupprice',
                                                'value' => 'number_format($data->syrupprice, 0, "", " ")',
                                            ),
                                            array(
                                                'class'=>'CButtonColumn',
                                                'template' => '{update} {delete}'
                                            ),
                                    ),
                            )); ?>
                              </div>
                        <div class="clear"></div>
                </div>
                <!--  end content-table-inner ............................................END  -->
		</td>
		<td id="tbl-border-right"></td>
        </tr>
        <tr>
            <th class="sized bottomleft"></th>
            <td id="tbl-border-bottom">&nbsp;</td>
            <th class="sized bottomright"></th>
	</tr>
    </table>
<div class="clear">&nbsp;</div>
